enablePlugins(ScalaJSBundlerPlugin)

name := "panda_fast"

scalaVersion := "2.13.8"

val reactVersion = "17.0.2"

Compile / npmDependencies ++= Seq(
  "jquery" -> "3.5.0",
  "react" -> reactVersion,
  "react-dom" -> reactVersion,
  "react-proxy" -> "1.1.8",
  "file-loader" -> "6.2.0",
  "style-loader" -> "2.0.0",
  "css-loader" -> "5.2.6",
  "html-webpack-plugin" -> "4.5.1",
  "copy-webpack-plugin" -> "6.4.0",
  "webpack-merge" -> "5.8.0",
  "react-router-dom" -> "6.2.1",
  "react-i18next" -> "11.16.2",
  "i18next" -> "21.6.14",
  "bootstrap-datepicker" -> "1.6.4",
  "react-bootstrap" -> "1.6.4",
  "bootstrap-sweetalert" -> "1.0.1",
  "layer-src" -> "3.5.1",
  "bootstrapvalidator" -> "0.5.4",
  "nprogress" -> "0.2.0",
  "react-transition-group" -> "4.4.2",
  "dom-helpers" -> "5.2.1",
  "bootstrap" -> "4.6.1",
  "qrcode" -> "1.5.0",
  "jszip" -> "3.7.1",
  "react-image-lightbox" -> "5.1.4",
)

libraryDependencies ++= Seq(
  "me.shadaj" %%% "slinky-web" % "0.7.2",
  "me.shadaj" %%% "slinky-hot" % "0.7.2",
  "org.scalatest" %%% "scalatest" % "3.2.9" % Test,
  "com.lihaoyi" %%% "scalatags" % "0.11.1",
  "com.github.alexarchambault" %%% "argonaut-shapeless_6.2" % "1.2.0",
  "com.softwaremill.quicklens" %%% "quicklens" % "1.6.1",
)

scalacOptions += "-Ymacro-annotations"

webpack / version := "4.40.2"
startWebpackDevServer / version := "3.11.2"

webpackResources := baseDirectory.value / "webpack" * "*"

fastOptJS / webpackConfigFile := Some(baseDirectory.value / "webpack" / "webpack-fastopt.config.js")
fullOptJS / webpackConfigFile := Some(baseDirectory.value / "webpack" / "webpack-opt.config.js")
Test / webpackConfigFile := Some(baseDirectory.value / "webpack" / "webpack-core.config.js")

fastOptJS / webpackDevServerExtraArgs := Seq("--inline", "--hot")
fastOptJS / webpackBundlingMode := BundlingMode.LibraryOnly()

Test / requireJsDomEnv := true

addCommandAlias("dev", ";fastOptJS::startWebpackDevServer;~fastOptJS")

addCommandAlias("build", "fullOptJS::webpack")
